#/bin/bash
rm -rf out
export NDK=/Users/zachary/Desktop/android/AndroidClang/ndk
export CC=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang
export CXX=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang++
export LD=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-ld
export SYSROOT=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot
export CFLAGS="--sysroot=$SYSROOT"
export CXXFLAGS="-I$SYSROOT/usr/include --sysroot=$SYSROOT"
export LDFLAGS="-lm"
#-DDARWIN_LTO_LIBRARY=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib \
#	-DDYLD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib \
	#-DCMAKE_C_COMPILER=$CC \
	#-DCMAKE_CXX_COMPILER=$CXX \
	#-DCMAKE_LINKER=$LD \

cmake -Bout ../llvm \
	-DCMAKE_TOOLCHAIN_FILE=/Users/zachary/Desktop/android/AndroidClang/ndk/build/cmake/android.toolchain.cmake \
	-DLLVM_ENABLE_PROJECTS=clang \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_CROSSCOMPILING=True \
	-DRUN_HAVE_POSIX_REGEX=0 \
	-DRUN_HAVE_STEADY_CLOCK=0 \
	-DBENCHMARK_ENABLE_LTO=False \
	-DBENCHMARK_ENABLE_TESTING=False \
	-DLLVM_ENABLE_PIC=False \
	-DLLVM_TABLEGEN=/Users/zachary/Desktop/android/AndroidClang/llvm/llvm-project/localbin/bin/llvm-tblgen \
	-DCLANG_TABLEGEN=/Users/zachary/Desktop/android/AndroidClang/llvm/llvm-project/localbin/bin/clang-tblgen \
	-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \
	-DLLVM_TARGET_ARCH=ARM \
	-DLLVM_TARGETS_TO_BUILD=ARM
